﻿<local:DocumentBase x:Class="WPFExcelReport.MVTVKPAY"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
         xmlns:wep="clr-namespace:WPFExcelReport"
        xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"      
         Loaded="Window_Loaded" 
     >
    <local:DocumentBase.Resources>
        <ucd:DD2ColorConverter  x:Key="dd2color"/>
    </local:DocumentBase.Resources>
    <Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="1*" /> 
        </Grid.RowDefinitions> 
        <StackPanel Grid.Row="0">
            <WrapPanel >
                <Label Content="PI#："    Width="38" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtPI" Width="157" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="1"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Beige" MaxLength="20" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="客户PO："    Width="67" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtPO" Width="186" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="2"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Pink" MaxLength="15" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="客户简称："    Width="84" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtKUNDNR" Width="128" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="5"
                         KeyUp="txtART_KeyUp" CharacterCasing="Upper" MaxLength="10" FontSize="18" Foreground="#FF141111" Height="33" />

            </WrapPanel>
            <WrapPanel  >
                <Label Content="下单日期从" Height="26" HorizontalAlignment="Left" Margin="0,5,0,0" Name="label3" VerticalAlignment="Top" Width="93" FontSize="18" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_DATE_SelectedDateChanged" Width="110" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label4" VerticalAlignment="Top" Width="19" FontSize="18" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_DATE_SelectedDateChanged" Width="110" />
                <Button Content="查询数据" Height="33" Margin="10,0,0,0"  Name="btnQuery" Width="55" Panel.ZIndex="8"
                        Click="btnQuery_Click"/>
                <Button Content="导出EXCEL" Height="33" Margin="10,0,0,0"  Name="btnEXCEL" Width="64" Panel.ZIndex="9"
                        Click="btnEXCEL_Click"/>
                <TextBlock Text="" Width="114" Margin="20,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="10"
                        Name="tbORDERNO" FontSize="16" Height="33" />
                <Button Content="设定完成" Height="33" Margin="10,0,0,0"  Name="btnFINISH" Width="64" Panel.ZIndex="11"
                        Click="btnFINISH_Click"/>
                <Button Content="取消完成" Height="33" Margin="10,0,0,0"  Name="btnUNDO" Width="64" Panel.ZIndex="12"
                        Click="btnUNDO_Click"/>
            </WrapPanel>
        </StackPanel>
         
        <DataGrid CanUserReorderColumns="True" 
                          CanUserResizeRows="True" CanUserSortColumns="True"
                          AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"  
              Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
                  EnableColumnVirtualization="True"  
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                               ItemsSource="{Binding}" x:Name="MasterDg" SelectionChanged="MasterDg_SelectionChanged"
                               Margin="0,10,0,0"  DataContext="{Binding}">
            <!--STATUS	CO	OPENITEM	ENTRYDATE	CSCODE	CUSTOMER	PAYMENT	DES	CURRENCY	ORDERVALUE	
                    PDEPOSIT	ADEPOSIT	GOODSVALUE	PBEFORSHIP	ABEFORSHIP	PAFTERSHIP VRTOTVALUES	AVRVALUES	
                    REMAINVALUE	AFTERDAYS-->
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=STATUS}" Header="状态" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=CO}" Header="销售单号" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="客户" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=CSCODE}" Header="客户号" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=OPENITEM}" Header="记帐号" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=ENTRYDATE}" Header="建单日期" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=PAYMENT}" Header="付款方式" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=DES}" Header="描述" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=CURRENCY}" Header="货币" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=ORDERVALUE}" Header="订单金额" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=PDEPOSIT}" Header="计算定金" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=ADEPOSIT}" Header="实付定金" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=GOODSVALUE}" Header="货物价值" Width="SizeToCells" MinWidth="40"/>
                <DataGridTextColumn Binding="{Binding Path=PBEFORSHIP}" Header="计算发货前应付" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=ABEFORSHIP}" Header="实际发货前付" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=PAFTERSHIP}" Header="计算发货后应付" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VRTOTVALUES}" Header="发票金额" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=AVRVALUES}" Header="已付发票金额" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=REMAINVALUE}" Header="欠款" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=AFTERDAYS}" Header="天数" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=PLVDAT}" Header="最后走货日期" Width="SizeToCells" MinWidth="30" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</local:DocumentBase>
